#include <limits.h>
#include "gtest/gtest.h"
#include "../include/AdListCacheManager.h"


// Tests factorial of negative numbers.
TEST(AdListCacheManagerTest,GetAdListFromCache) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	AdListCacheManager cacheManager;
	AdListForAllSlots* adListForAllSlots=cacheManager.GetAdListForAllSlots();
	ASSERT_EQ(0,adListForAllSlots->GetSlotCount());
}

TEST(AdListCacheManagerTest,RefreshAdListForAllSlotsCache1) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	AdListCacheManager cacheManager;
	AdListForAllSlots* cacheData=new AdListForAllSlots();
	AdListForOneSlot* adListForOneSlot=new AdListForOneSlot();
	cacheData->AddAdList(adListForOneSlot);
	cacheManager.RefreshAdListForAllSlotsCache(cacheData);
	AdListForAllSlots* adListForAllSlots=cacheManager.GetAdListForAllSlots();
	ASSERT_EQ(1,adListForAllSlots->GetSlotCount());
}

TEST(AdListCacheManagerTest,RefreshAdListForAllSlotsCache2) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	AdListCacheManager cacheManager;
	AdListForAllSlots* cacheData1=new AdListForAllSlots();
	AdListForOneSlot* adListForOneSlot=new AdListForOneSlot();
	cacheData1->AddAdList(adListForOneSlot);
	cacheManager.RefreshAdListForAllSlotsCache(cacheData1);
	AdListForAllSlots* cacheData2=new AdListForAllSlots();
	AdListForOneSlot* adListForOneSlot1=new AdListForOneSlot();
	AdListForOneSlot* adListForOneSlot2=new AdListForOneSlot();
	cacheData2->AddAdList(adListForOneSlot1);
	cacheData2->AddAdList(adListForOneSlot2);
	cacheManager.RefreshAdListForAllSlotsCache(cacheData2);
	AdListForAllSlots* adListForAllSlots=cacheManager.GetAdListForAllSlots();
	ASSERT_EQ(2,adListForAllSlots->GetSlotCount());
}